主题
加密模型包到文件 - YoloEncryptModel
函数简介
将明文模型与可选类别名表打成欧拉加密包并写入磁盘;包头写入 modelType、inferenceType。
接口名称
YoloEncryptModelDLL 调用
int YoloEncryptModel(long ola, string modelPath, string ncnnParamPath, string namesLabel, string password, int modelType, int inferenceType, string savePath);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。 |
| modelPath | 字符串 | 主模型路径 |
| ncnnParamPath | 字符串 | NCNN .param,可空 |
| namesLabel | 字符串 | 类别名文件,可空 |
| password | 字符串 | 加密密码 |
| modelType | 整数型 | 模型类型 |
| inferenceType | 整数型 | 推理类型 |
| savePath | 字符串 | 输出加密包路径 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");csharp
using OLAPlug;
var ola = new OLAPlugServer();
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
# 模型加解密通常用于发布/部署流程
ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");cpp
var ola = com("OlaPlug.OlaSoft")
// 模型加解密通常用于发布/部署流程
var ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' 模型加解密通常用于发布/部署流程
ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")text
.局部变量 ola, OLAPlug
ola.创建 ()
' 模型加解密通常用于发布/部署流程
ret = ola.YoloEncryptModel(“models/raw.onnx“, “models/raw.param“, “labels.txt“, “pwd“, 0, 0, “models/out.olam“)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// 模型加解密通常用于发布/部署流程
var ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// 模型加解密通常用于发布/部署流程
整数 ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
YoloEncryptModel(instance, "models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");csharp
long instance = CreateCOLAPlugInterFace();
YoloEncryptModel(instance, "models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
YoloEncryptModel(instance, "models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")返回值
整数型:1 成功,0 失败。
注意事项
- 需要插件已开通 YOLO 模块权限(Reg、Login的FeatureList中包含YOLO特性)。
| 值 | 含义 |
|---|---|
| 0 | TensorRT Engine(.engine) |
| 1 | ONNX(.onnx) |
| 2 | NCNN(.bin + .param 双文件) |
| 值 | 含义 |
|---|---|
| 0 | Detect 目标检测 |
| 1 | Classify 图像分类 |
| 2 | Segment 实例分割 |
| 3 | Pose 姿态估计 |
| 4 | Obb 旋转框检测 |
